package org.examplexx.mytestwebapplication.controller;

import org.examplexx.mytestwebapplication.Mapper.UserMapper;
import org.examplexx.mytestwebapplication.service.Login_service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.examplexx.mytestwebapplication.pojo.Result;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Login {
    @Autowired
    UserMapper userMapper;
    private Login_service login_service;
    @RequestMapping("/login")
    public Result login(String username, String password) {
        Result result = new Result();
        if (userMapper.getUserByUsernameAndPassword(username, password).size()!=0) {
            result.success();
        }else{
            result.fail();
        }
        result.setData(username);
        return result;
    }
}